package Utils;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class MapUtil {

	public static String getKeyFromValue(Map<String, String> map, Object value)

	{

		// 方法一：循环map里面的每一对键值对，然后获取key和value
		for (Entry<String, String> vo : map.entrySet()) {
			if (vo.getValue().equals(value)) {
				return vo.getKey();
			}
		}

		return null;
	}

	public static Map<String, Object> getUpperKeyFromMap(Map<String, Object> map)

	{

		Map<String, Object> mapUpper = new HashMap<String, Object>();

		// 方法一：循环map里面的每一对键值对，然后获取key和value
		for (Entry<String, Object> vo : map.entrySet()) {
			mapUpper.put(vo.getKey().toUpperCase(), vo.getValue());
		}

		return mapUpper;
	}

	public static Map<String, Object> getLowerKeyFromMap(Map<String, Object> map)

	{

		Map<String, Object> mapUpper = new HashMap<String, Object>();

		// 方法一：循环map里面的每一对键值对，然后获取key和value
		for (Entry<String, Object> vo : map.entrySet()) {
			mapUpper.put(vo.getKey().toLowerCase(), vo.getValue());
		}

		return mapUpper;
	}

}